import React,{useState} from 'react';
import ReactDOM from 'react-dom/client';
const root = ReactDOM.createRoot(document.getElementById('root'));
function Child1(props){
	return (
		<p>{props.msg}</p>
	)
}
function Child2(props){
	return (
		<button onClick={()=>props.setMsg('来自Child2的消息')}>点击</button>
	)
}
function Parent(){
	const [msg,setMsg] = useState('');
	return (
		<div>
			<Child1 msg={msg}/>
			<Child2 setMsg={setMsg}/>
		</div>
	)
}
root.render(<Parent />);